package game.view
{
	import flash.display.Sprite;
	
	import game.controller.GameController;
	import game.model.GameModel;
	import game.model.SceneModel;
	import game.view.scene.MapSceneView;

	public class GameMainView extends Sprite
	{
		private var _controller:GameController;
		private var _model:GameModel;
		private var _sceneModel:SceneModel;
		private var _mapSceneView:MapSceneView;
		
		public function GameMainView(controller:GameController, model:GameModel, sceneModel:SceneModel)
		{
			_controller=controller;
			_model=model;
			_sceneModel=sceneModel;
			initialize();
		}
		
		/**
		 * 初始化运行
		 */		
		private function initialize():void
		{
			setView();
			setEvent();
		}
		
		private function setView():void
		{
			_mapSceneView=new MapSceneView(_controller, _model, _sceneModel);
			addChild(_mapSceneView);
		}
		
		/**
		 *设置事件
		 */		
		private function setEvent():void
		{

		}
		
		public function show():void
		{
			if(!_controller.contains(this))
			{
				_controller.addChild(this);
			}
			if(!this.visible)
			{
				this.visible=true;
			}
		}
		
		public function hide():void
		{
			if(_controller.contains(this))
			{
				_controller.removeChild(this);
			}
		}
		
		public function dispose():void
		{
			_controller=null
			_model=null;
		}
	}
}